﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:commonAddin="clr-namespace:theeg.DependencyAnalysis.CommonAddin"
                    xmlns:converters="clr-namespace:theeg.DependencyAnalysis.CommonAddin.Converters">

    <converters:IsNullToVisibilityConverter x:Key="IsNullToVisibilityConverter"></converters:IsNullToVisibilityConverter>
    <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BoolToVisibilityConverter>

    <Style TargetType="{x:Type TabItem}">
        <Setter Property="Foreground" Value="White"></Setter>
        <Setter Property="FontSize" Value="16"></Setter>
        <Setter Property="FontWeight" Value="Bold"></Setter>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid>
                        <Border 
            Name="Border"
            Margin="0,0,-4,0" 
            Background="Transparent"
                            BorderBrush="#FF25334B"
            BorderThickness="0,0,0,4" 
            CornerRadius="0" >
                            <ContentPresenter x:Name="ContentSite"
              VerticalAlignment="Center"
              HorizontalAlignment="Center"
              ContentSource="Header"
              Margin="12,2,12,2"
              RecognizesAccessKey="True"/>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Panel.ZIndex" Value="100" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="Tomato"></Setter>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="DarkGray" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SelectButtonStyle" TargetType="Button">
        <Setter Property="FontWeight" Value="Regular"></Setter>
        <Setter Property="Command" Value="{x:Static commonAddin:AddinWindow.SelectCommand}"></Setter>
        <Setter Property="CommandParameter" Value="{Binding}"></Setter>
        <Setter Property="VerticalAlignment" Value="Center"></Setter>
        <Setter Property="Background" Value="Transparent"></Setter>
        <Setter Property="BorderBrush" Value="Transparent"></Setter>
        <Setter Property="Foreground" Value="White"></Setter>
        <Setter Property="ToolTip" Value="{Binding Name}"></Setter>
        <Setter Property="Margin" Value="3,2"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1">
                        <ContentControl Foreground="{TemplateBinding Foreground}" Content="{TemplateBinding Content}" HorizontalAlignment="Left"></ContentControl>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="BorderBrush" Value="#FF196990"></Setter>
                <Setter Property="Background" Value="#FF25334B"></Setter>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="FlatButtonStyle" TargetType="Button">
        <Setter Property="Background" Value="Transparent"></Setter>
        <Setter Property="BorderBrush" Value="Transparent"></Setter>
        <Setter Property="Foreground" Value="White"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1">
                        <ContentControl Foreground="{TemplateBinding Foreground}" Content="{TemplateBinding Content}"></ContentControl>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="BorderBrush" Value="#FF196990"></Setter>
                <Setter Property="Background" Value="#FF25334B"></Setter>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" Value="0.5"></Setter>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="NullButtonStyle" TargetType="Button">
        <Setter Property="FontWeight" Value="Bold"></Setter>
        <Setter Property="FontSize" Value="16"></Setter>
        <Setter Property="Command" Value="{x:Static commonAddin:AddinWindow.SelectCommand}"></Setter>
        <Setter Property="CommandParameter" Value="{Binding}"></Setter>
        <Setter Property="VerticalAlignment" Value="Center"></Setter>
        <Setter Property="Background" Value="#01000000"></Setter>
        <Setter Property="Foreground" Value="White"></Setter>
        <Setter Property="BorderBrush" Value="Transparent"></Setter>
        <Setter Property="Margin" Value="3,2"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="2">
                        <ContentControl Content="{TemplateBinding Content}" HorizontalAlignment="Left" FontWeight="{TemplateBinding FontWeight}"
                                            FontSize="{TemplateBinding FontSize}"></ContentControl>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="#FF25334B"></Setter>
                <Setter Property="BorderBrush" Value="#FF196990"></Setter>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="NullToggleButtonStyle" TargetType="ToggleButton">
        <Setter Property="FontWeight" Value="Bold"></Setter>
        <Setter Property="FontSize" Value="16"></Setter>
        <Setter Property="VerticalAlignment" Value="Center"></Setter>
        <Setter Property="Background" Value="#01000000"></Setter>
        <Setter Property="Foreground" Value="White"></Setter>
        <Setter Property="BorderBrush" Value="Transparent"></Setter>
        <Setter Property="Margin" Value="3,2"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToggleButton">
                    <Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="2">
                        <ContentControl Content="{TemplateBinding Content}" HorizontalAlignment="Left" FontWeight="{TemplateBinding FontWeight}"
                                            FontSize="{TemplateBinding FontSize}"></ContentControl>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="#FF25334B"></Setter>
                <Setter Property="BorderBrush" Value="#FF196990"></Setter>
            </Trigger>
            <Trigger Property="IsChecked" Value="True">
                <Setter Property="BorderBrush" Value="#FF38A9B0"></Setter>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Grid>
                        <Rectangle Stroke="{TemplateBinding Foreground}" Fill="{TemplateBinding Background}" RadiusX="3" RadiusY="3"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type ScrollBar}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollBar}">
                    <Grid>
                        <Grid Background="Transparent" Width="10" MinWidth="10">
                            <Grid.RowDefinitions>
                                <RowDefinition MaxHeight="5"/>
                                <RowDefinition Height="*"/>
                                <RowDefinition MaxHeight="5"/>
                            </Grid.RowDefinitions>

                            <Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}" Grid.Row="1">
                                <Track.Thumb>
                                    <Thumb Style="{StaticResource ScrollBarThumb}"
                                       Background="#FF7A7A7A" Foreground="#FFEDEDED"/>
                                </Track.Thumb>
                            </Track>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
                <Trigger.Setters>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ScrollBar}">
                                <Grid>
                                    <Grid Background="Transparent" Height="10" MinHeight="10">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition MaxWidth="5"/>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition MaxWidth="5"/>
                                        </Grid.ColumnDefinitions>

                                        <Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}" Grid.Column="1">
                                            <Track.Thumb>
                                                <Thumb Style="{StaticResource ScrollBarThumb}"
                                       Background="#FF7A7A7A" Foreground="#FFEDEDED"/>
                                            </Track.Thumb>
                                        </Track>
                                    </Grid>
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Trigger.Setters>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="ScrollViewer">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ScrollViewer">
                    <Grid x:Name="Grid" Background="{TemplateBinding Background}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>

                        <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" 
                                                CanContentScroll="{TemplateBinding CanContentScroll}"
                                                CanHorizontallyScroll="False"
                                                CanVerticallyScroll="False"
                                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                                Content="{TemplateBinding Content}" 
                                                Grid.Column="0"
                                                Margin="{TemplateBinding Padding}"
                                                Grid.Row="0"
                                                Grid.ColumnSpan="2"
                                                Grid.RowSpan="2"/>

                        <ScrollBar x:Name="PART_VerticalScrollBar" 
                                   AutomationProperties.AutomationId="VerticalScrollBar" 
                                   Cursor="Arrow"
                                   Grid.Column="1"
                                   Maximum="{TemplateBinding ScrollableHeight}"
                                   Minimum="0"
                                   Grid.Row="0" 
                                   Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" 
                                   Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" 
                                   ViewportSize="{TemplateBinding ViewportHeight}"/>

                        <ScrollBar x:Name="PART_HorizontalScrollBar" 
                                   AutomationProperties.AutomationId="HorizontalScrollBar" 
                                   Cursor="Arrow"
                                   Grid.Column="0"
                                   Maximum="{TemplateBinding ScrollableWidth}"
                                   Minimum="0"
                                   Grid.Row="1" 
                                   Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" 
                                   Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" 
                                   ViewportSize="{TemplateBinding ViewportWidth}"/>
                    </Grid>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>